package com.yuan.common.message;

import java.text.MessageFormat;
import java.util.ResourceBundle;

/**
 * 向页面展示的Message
 * @author Beni
 *
 */
public class InformationMessage {
	
	public static final String BUNDLE_NAME_INFORMATION = "InformationMessages";

	private static ResourceBundle bundle ;
	
	//消息
	private String message;
	
	//消息类型：提示，警告，错误
	private String messageType;
	
	static{
		//加载properties配置文件
		bundle = ResourceBundle.getBundle(InformationMessage.BUNDLE_NAME_INFORMATION);
	}
	
	public InformationMessage(String bundleKey, Object... messageParameters) {
		this.message=MessageFormat.format(bundle.getString(bundleKey),messageParameters);
		this.messageType=bundleKey.substring(0, 3);
	}

	public String getMessage() {
		return message;
	}

	public void setMessage(String message) {
		this.message = message;
	}

	public String getMessageType() {
		return messageType;
	}

	public void setMessageType(String messageType) {
		this.messageType = messageType;
	}
	
}
